package com.yupfeg.test.simple

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.yupfeg.livedata.EventLiveData
import com.yupfeg.livedata.MutableEventLiveData

/**
 *
 * @author yuPFeG
 * @date 2021/09/19
 */
class SimpleEventViewModel : ViewModel(){
    private var num = 0

    val simpleEvent : EventLiveData<String>
        get() = mSimpleEvent
    private val mSimpleEvent = MutableEventLiveData<String>()


    val normalLiveData : LiveData<String>
        get() = mNormalLiveData
    private val mNormalLiveData = MutableLiveData<String>()


    fun sendSimpleEvent(){
        mSimpleEvent.value = "test simple event"
    }

    fun getTestData(){
        num++
        mNormalLiveData.value = "测试数据 list${num}"
    }
}